package flc.ast.adapter;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

import flc.ast.R;
import flc.ast.bean.MusicBean;
import stark.common.basic.adaptermutil.StkEmptyProvider;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

public class VideoMusicAdapter extends StkProviderMultiAdapter<MusicBean> {
    public VideoMusicAdapter() {
        addItemProvider(new StkEmptyProvider<>(78));
        addItemProvider(new MusicItemProvider());
    }

    private class MusicItemProvider extends BaseItemProvider<MusicBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_video_music;
        }

        @Override
        public void convert(@NotNull BaseViewHolder baseViewHolder, MusicBean musicBean) {
            baseViewHolder.setImageResource(R.id.ivVideoMusicImage, musicBean.getMusicImage());
            baseViewHolder.setText(R.id.tvVideoMusicName, musicBean.getMusicName());
            baseViewHolder.setGone(R.id.ivVideoMusicSelector, !musicBean.isSelected());
        }
    }
}
